package Interfaces;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;


import Modelo.Modelo;

public class PreviewCalculaListener implements ActionListener
{
	private int index;
	
	private Modelo modelo;
	
	private InterfaceCalcular it;
	
	public PreviewCalculaListener(InterfaceCalcular it, Modelo modelo, int index)
	{
		this.index = index;
		
		this.modelo = modelo;
		
		this.it = it;
	}
	
	@Override
	public void actionPerformed(ActionEvent e) 
	{
		it.getPreviewFormula().setText("  " + modelo.getEqNome(index) + ": \n\t" + modelo.getFormula(index));
		
		it.setSelected(index);
	
		it.getPreviewFormula().repaint();
	}

}
